<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

<h:head>
    <f:facet name="first">
        <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
        <meta name="apple-mobile-web-app-capable" content="yes"/>
    </f:facet>
    <title>菠萝天眼</title>
    <h:outputScript name="js/nanoscroller.js" library="omega-layout"/>
    <h:outputScript name="js/layout.js" library="omega-layout"/>
    <h:outputScript name="js/zh_cn.js" library="omega-layout"/>
    <ui:insert name="head"/>
</h:head>

<h:body styleClass="main-body">
    <div class="wrapper">

        <h:form id="topForm">
            <p:growl id="message" showDetail="true" autoUpdate="true" showSummary="false"/>
            <p:importConstants type="com.tuanzi.loan.business.constants.DictionaryCode" var="DictionaryCode"/>
            <p:confirmDialog global="true" showEffect="fade"
                             hideEffect="fade" closable="false">
                <p:commandButton value="是" styleClass="ui-confirmdialog-yes" icon="ui-icon-check"/>
                <p:commandButton value="否" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close"/>
            </p:confirmDialog>
            <p:poll interval="10" listener="#{currentUserBean.refreshHeader}" update="undoWorkCount"/>

            <div class="topbar clearfix">
                <a id="omega-menu-button" href="#">
                    <span class="fa fa-bars"></span>
                </a>

                <span class="topbar-title"><ui:insert name="title"></ui:insert></span>

                <a id="options-menu-button" href="#">
                    <span class="fa fa-ellipsis-h"></span>
                </a>

                <div id="topbar-icons" class="animated">
                <span class="topbar-search">
                    <input type="text" placeholder="Search"/>
                    <span class="topbar-search-icon fa fa-search"></span>
                </span>
                    <p:commandLink oncomplete="PF('announcementDialogWidgetVar').show();"
                                   update="announcementDialogForm:announcementDialog"
                                   rendered="#{currentUserBean.announcements.size() > 0}">
                        <span class="topbar-item-text">Announcement</span>
                        <span class="topbar-icon fa fa-bullhorn animated swing"></span>
                        <span class="topbar-badge animated rubberBand"><h:outputText value="!!"/></span>
                    </p:commandLink>
                    <p:link outcome="/views/workbench.xhtml">
                        <span class="topbar-item-text">Messages</span>
                        <span class="topbar-icon fa fa-envelope-o animated swing"></span>
                        <span class="topbar-badge animated rubberBand"><h:outputText id="undoWorkCount"
                                                                                     value="#{currentUserBean.undoWork}"/></span>
                    </p:link>
                    <!--<p:link outcome="/views/user-setting.xhtml">-->
                        <!--<span class="topbar-item-text">Settings</span>-->
                        <!--<span class="topbar-icon fa fa-gear"></span>-->
                    <!--</p:link>-->
                    <p:link outcome="/views/user-setting.xhtml">
                        <span class="topbar-item-text">User</span>
                        <span class="topbar-icon fa fa-user"></span>
                    </p:link>
                    <p:link href="/logout-process">
                        <span class="topbar-item-text">登出</span>
                        <span class="topbar-icon fa fa-sign-out"></span>
                    </p:link>
                </div>
            </div>
        </h:form>


        <ui:include src="sidebar.xhtml"/>

        <div class="main">
            <h:form id="announcementDialogForm">
                <p:dialog id="announcementDialog" widgetVar="announcementDialogWidgetVar" modal="true" header="公告"
                          resizable="false" width="700" height="350">
                    <div class="ui-g ui-fluid">
                        <div class="ui-g-12">
                            <ui:repeat value="#{currentUserBean.announcements}" var="announcement">
                                <p:panel header="#{announcement.title}" closable="false" widgetVar="panel"
                                         style="margin-bottom:20px">
                                    <h:panelGrid cellpadding="10">
                                        <h:outputText value="#{announcement.content}"/>
                                    </h:panelGrid>
                                </p:panel>
                            </ui:repeat>
                        </div>
                    </div>
                </p:dialog>
            </h:form>
            <ui:insert name="content"/>
        </div>

        <ui:include src="footer.xhtml"/>
    </div>

    <p:ajaxStatus style="width:32px;height:32px;position:fixed;right:7px;bottom:7px">
        <f:facet name="start">
            <p:graphicImage name="images/preloader.gif" library="omega-layout" style="width: 32px;"/>
        </f:facet>

        <f:facet name="complete">
            <h:outputText value=""/>
        </f:facet>
    </p:ajaxStatus>

    <h:outputStylesheet name="css/animate.css" library="omega-layout"/>
    <h:outputStylesheet name="css/nanoscroller.css" library="omega-layout"/>
    <h:outputStylesheet name="css/layout.css" library="omega-layout"/>
    <h:outputStylesheet name="css/custom.css" library="omega-layout"/>
</h:body>

</html>